asm
  ld sp,$BFFF
  end asm

#include "./library/smsrnd.bas"
#include "./library/charmap01.bas"

dim eee as uinteger at $A010
dim seed as uinteger at $A012
dim delay as uinteger at $A014
dim eex as uinteger at $A016
dim eey as uinteger at $A018
dim eey2 as uinteger at $A01A
dim ejst as uinteger at $A01C
dim exps as uinteger at $A01E
dim eqq as uinteger at $A020

sub putchar(txpos as uinteger,typos as uinteger,tch as uinteger, tadr as uinteger,txor as ubyte)
  dim trt as uinteger at $A000
  for trt=0 to 7
    poke $A200+(txpos band 31)+(trt*32)+((typos mod 28)*256),peek(tadr+(tch*8)+trt) bxor txor
    next
  end sub

sub writetext(txpos2 as uinteger,typos2 as uinteger,ttxt as uinteger, tleng as uinteger,tadr2 as uinteger, txor2 as uinteger)
  dim trt2 as uinteger at $A002
  for trt2=0 to tleng-1
    putchar(txpos2+trt2,typos2,peek(ttxt+trt2),tadr2,txor2)
    next
  end sub

for eey=0 to 27
  for eex=0 to 31
    seed=smsrnd(seed)
    putchar(eex,eey,96+(seed mod 9),@charmap01-253,$FF)
    next:next

for eey=0 to 15
  for eex=0 to 15
    putchar(eex+2,eey+1,eex+(eey*16),@charmap01-253,$FF)
    next:next

writetext(2,26,@text01,14,@charmap01-253,$FF)

exps=16
eee=0

do
  ejst=peek($E008) bxor 255
  putchar(4,24,48+ (ejst mod 10)  ,@charmap01-253,$FF)
  putchar(3,24,48+ ( int(ejst/10) mod 10)  ,@charmap01-253,$FF)
  putchar(2,24,48+ ( int(ejst/100) mod 10)  ,@charmap01-253,$FF)
  eee=eee+1
  if (ejst band 1)<>0 then:exps=exps-1:end if
  if (ejst band 2)<>0 then:exps=exps+1:end if
  eqq=96+(eee mod 9)
  if (ejst band 4)<>0 then:eqq=96+4:end if
  putchar(exps,22,eqq,@charmap01-253,$FF)
  loop



seed=0

delay=100

'for eey2=0 to 27
'  for eex=0 to 31
'    for eey=0 to 7
'      for eee=1 to delay:next
'      seed=smsrnd(seed)
'      poke $A200+eex+(eey*32)+(eey2*256),seed
'      next:next:next


do
  seed=smsrnd(seed):eey2=seed mod 28
  seed=smsrnd(seed):eex=seed band 31
  for eey=0 to 7
    poke $A200+eex+(eey*32)+(eey2*256),$00
    next
  seed=smsrnd(seed):eey2=seed mod 28
  seed=smsrnd(seed):eex=seed band 31
  for eey=0 to 7
    poke $A200+eex+(eey*32)+(eey2*256),$FF
    next
  seed=smsrnd(seed):eey2=seed mod 28
  seed=smsrnd(seed):eex=seed band 31
  for eey=0 to 7
    seed=smsrnd(seed)
    poke $A200+eex+(eey*32)+(eey2*256),seed
    next
  loop


delay=1000
do
  for eee=$A200 to $BDFF
    seed=smsrnd(seed)
    poke eee,seed
    next
  for eee=1 to delay:next
  for eee=$A200 to $BDFF
    poke eee,0
    next
  for eee=1 to delay:next
  loop


do
  loop

text01:
asm
  defb "HELLO WORLD!!!!!"
  end asm





'-------------------------------------------------------------------------------



